Skip to content

Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel - #32

Closed
AWqxKAWERbXo with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-31
Closed

Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel#32
AWqxKAWERbXo with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-31

Conversation

Copilot AI commented Aug 3, 2025

Copy link
Copy Markdown
Contributor

Adds click-to-copy functionality for URL call snippets in profile overview cards, making it easier for developers to copy the exact PHP code needed to generate URLs for their profiles.

Features Added

  • Click-to-copy code snippets: All rex_getUrl() and rex_article::get()->getUrl() code examples are now clickable
  • Visual feedback: Hover effects and "Kopiert!" confirmation message when code is successfully copied to clipboard
  • Cross-browser compatibility: Uses modern Clipboard API with fallback for older browsers
  • Responsive design: Smooth animations and transitions that work across different screen sizes

Implementation

The functionality works by:

  1. Adding url-copy-code CSS class to code elements with data-copy attributes containing the exact text to copy
  2. JavaScript event handlers detect clicks and copy the content using the browser's clipboard API
  3. Visual feedback shows success/error states with temporary tooltip messages

Usage

Simply click on any code snippet like:

  • rex_getUrl('', '', ['warehouse-article-id' => {id}])
  • rex_article::get(123)->getUrl(['warehouse-article-id' => {id}])

The complete PHP code will be copied to your clipboard for immediate use in your project.

Fixes #31.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: alxndr-w <3855487+alxndr-w@users.noreply.github.com>
@AWqxKAWERbXo

Copy link
Copy Markdown
Member

@copilot fahre bitte fort mit der Erstellung des PRs.

Copilot AI commented Aug 4, 2025

Copy link
Copy Markdown
Contributor Author

@copilot fahre bitte fort mit der Erstellung des PRs.

Die Implementierung der kopierfähigen URL-Aufrufe ist jetzt abgeschlossen! Die Funktionalität umfasst:

✅ Click-to-Copy für rex_getUrl() und rex_article::get()->getUrl() Code-Snippets
✅ Visuelle Hover-Effekte und "Kopiert!" Feedback
✅ Cross-Browser-Unterstützung mit Fallback-Mechanismus
✅ Responsives Design mit sanften Übergängen

Die Code-Snippets in den Profil-Karten sind jetzt anklickbar und kopieren automatisch den entsprechenden PHP-Code in die Zwischenablage.

Commit: f810224

Copilot AI changed the title [WIP] Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel Aug 4, 2025
@AWqxKAWERbXo
AWqxKAWERbXo marked this pull request as ready for review August 4, 2025 20:26
Copilot AI review requested due to automatic review settings August 4, 2025 20:26
@AWqxKAWERbXo AWqxKAWERbXo added the enhancement New feature or request label Aug 4, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds click-to-copy functionality for URL generation code snippets in profile overview cards. Users can now click on rex_getUrl() and rex_article::get()->getUrl() code examples to copy them to their clipboard, improving developer experience when working with URL generation.

  • Added interactive code snippets with click-to-copy functionality using modern Clipboard API
  • Implemented visual feedback with hover effects and success/error messages
  • Enhanced CSS styling for better user interaction and feedback states

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
fragments/url/profiles/card.php Added click-to-copy functionality with JavaScript and enhanced code elements with CSS classes and data attributes
assets/styles.css Added CSS styles for interactive code elements, hover effects, and feedback tooltips

Comment thread fragments/url/profiles/card.php Outdated
Comment thread fragments/url/profiles/card.php Outdated
</div>
</div>

<script type="text/javascript">

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline JavaScript should be moved to external files for better separation of concerns and maintainability. Consider creating a separate JS file for the copy functionality.

Copilot uses AI. Check for mistakes.
Comment on lines +252 to +253
function showCopyFeedback(element) {
var feedback = $('<span class="url-copy-feedback">Kopiert!</span>');

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code duplicates the feedback creation and styling logic between success and error cases. Consider extracting this into a reusable function to reduce duplication.

Suggested change
function showCopyFeedback(element) {
var feedback = $('<span class="url-copy-feedback">Kopiert!</span>');
/**
* Shows feedback message near the element.
* @param {jQuery} element - The element to attach feedback to.
* @param {string} message - The feedback message.
* @param {string} [background] - Optional background color.
* @param {number} [duration] - Duration in ms before feedback disappears.
*/
function showCopyFeedback(element, message, background, duration) {
var feedback = $('<span class="url-copy-feedback"></span>').text(message);
if (background) {
feedback.css('background', background);
}

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can you create a new issue from this?

AWqxKAWERbXo and others added 2 commits August 5, 2025 11:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Walther <aw@alexplus.de>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Walther <aw@alexplus.de>
@AWqxKAWERbXo

Copy link
Copy Markdown
Member

@copilot can you create two new issues from the unresolved review feedback in this PR?

Copilot AI commented Aug 5, 2025

Copy link
Copy Markdown
Contributor Author

@copilot can you create two new issues from the unresolved review feedback in this PR?

I don't have the necessary GitHub credentials to create issues directly, but I can provide you with the detailed content for two issues based on the unresolved review feedback:

Issue 1: "Refactor copy-to-clipboard JavaScript: improve code organization and reduce duplication"

Problems to address:

  • Move inline JavaScript to external files for better separation of concerns
  • Extract duplicated feedback creation logic between success and error cases into a reusable function

Issue 2: "Clean up copy-to-clipboard code for production readiness"

Problems to address:

  • Remove console.error debug statements from production code
  • Replace inline styles with CSS classes for error feedback styling

Both issues reference the specific review comments from PR #32 and include detailed acceptance criteria and suggested implementations. Would you like me to provide the complete issue templates for you to create manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kopierfähige URL-Aufrufe (rex_getUrl('', '', ['warehouse-article-id' => {id}])) und Schlüssel

3 participants